@echo off
echo === PWA功能完整设置和推送脚本 ===
echo.

REM 步骤1: 初始化Git仓库
echo [1/5] 正在初始化Git仓库...
"C:\Program Files\Git\cmd\git.exe" init
if errorlevel 1 goto error

REM 步骤2: 配置用户信息
echo [2/5] 正在配置Git用户信息...
"C:\Program Files\Git\cmd\git.exe" config user.name "Elite Magazine"
"C:\Program Files\Git\cmd\git.exe" config user.email "elite@magazine.com"

REM 步骤3: 添加所有PWA相关文件
echo [3/5] 正在添加PWA功能文件...
"C:\Program Files\Git\cmd\git.exe" add service-worker.js
"C:\Program Files\Git\cmd\git.exe" add manifest.json
"C:\Program Files\Git\cmd\git.exe" add themes/magazine-theme/layouts/_default/baseof.html
"C:\Program Files\Git\cmd\git.exe" add static/css/mobile-optimization.css
"C:\Program Files\Git\cmd\git.exe" add static/offline.html
"C:\Program Files\Git\cmd\git.exe" add static/offline-test.html
"C:\Program Files\Git\cmd\git.exe" add validate_pwa.py

REM 步骤4: 提交更改
echo [4/5] 正在提交PWA功能...
"C:\Program Files\Git\cmd\git.exe" commit -m "feat: 添加完整的PWA功能支持

- 添加service-worker.js实现离线缓存功能
- 添加manifest.json配置PWA应用清单
- 添加移动端优化CSS样式文件
- 添加离线页面和测试页面
- 更新baseof.html模板支持PWA功能
- 添加PWA验证工具"
if errorlevel 1 goto error

REM 步骤5: 显示下一步操作
echo [5/5] 设置完成！
echo.
echo === 请手动完成以下步骤 ===
echo.
echo 1. 在Gitee上创建新仓库
echo 2. 执行以下命令配置远程仓库:
echo    git remote add origin https://gitee.com/你的用户名/你的仓库名.git
echo.
echo 3. 然后执行推送:
echo    git push -u origin main
echo.
echo 或者如果是master分支:
echo    git push -u origin master
echo.
echo 当前Git状态:
"C:\Program Files\Git\cmd\git.exe" status
echo.
goto end

:error
echo 错误: Git命令执行失败！
echo 请确保Git已正确安装。
echo.

:end
echo 按任意键退出...
pause > nul